:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --border-color: rgba(0, 0, 0, 0.125);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --footer-bg: #f1f1f1;
}

.dark-mode {
    --primary-color: #4da6ff;
    --primary-hover: #3498db;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: rgba(255, 255, 255, 0.125);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --footer-bg: #1a1a1a;
}

body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.content {
    flex: 1;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

h1 {
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

h1:after {
    content: '';
    position: absolute;
    width: 60%;
    height: 3px;
    background: var(--primary-color);
    bottom: 0;
    left: 20%;
    border-radius: 2px;
}

.form-container {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.dark-mode .form-control, .dark-mode .form-select {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
    background-color: var(--card-bg);
    color: var(--text-color);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    transition: all 0.3s;
}

.dark-mode .btn-secondary {
    background-color: #4a5a6b;
    border-color: #4a5a6b;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    transform: translateY(-2px);
}

#theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s;
}

#theme-toggle:hover {
    transform: rotate(30deg);
    background-color: var(--primary-hover);
}

#audio-player {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-in;
    transition: background-color 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#result, #console {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

#console {
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

audio {
    width: 100%;
    border-radius: 30px;
}

.download-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
    transition: background-color 0.3s, transform 0.2s;
    font-weight: 500;
}

.download-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    color: white;
}

footer {
    background-color: var(--footer-bg);
    color: var(--text-color);
    padding: 1rem 0;
    margin-top: auto;
    transition: background-color 0.3s;
    border-top: 1px solid var(--border-color);
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.loading {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 13px;
    vertical-align: middle;
}

.loading div {
    position: absolute;
    top: 0;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary-color);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading div:nth-child(1) {
    left: 8px;
    animation: loading1 0.6s infinite;
}

.loading div:nth-child(2) {
    left: 8px;
    animation: loading2 0.6s infinite;
}

.loading div:nth-child(3) {
    left: 32px;
    animation: loading2 0.6s infinite;
}

.loading div:nth-child(4) {
    left: 56px;
    animation: loading3 0.6s infinite;
}

@keyframes loading1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes loading3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes loading2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}